extensions [sound]
breed [ landers lander ]

globals [
  ;; environmental
  platform-xcor     ;; the x coordinate of the center of the platform
  platform-ycor
  gravity
  
  ;; landers
  numlanders
  toofast
  ts  ts2
  lander-size
  Otto                         ;;the autonomous lander
  Peon                         ;;the lander I control

  ;; fuzzy logic control (for Otto)
  x_0 x_a                      ;;parameters for X shape function
  y_0 y_a  y_b                 ;;parameters for Y shape function
  v_a v_b                      ;;parameters for VX and VY shape functions
  Y_N  Y_F                     ;;Y-function membership (%)
  X_L  X_M  X_R X_F            ;;X-function membership (%)
  VX_HN VX_MN VX_L VX_MP VX_HP ;;VX-function membership (%)
  VY_HN VY_MN VY_L VY_MP VY_HP ;;VY-function membership (%)
  tr_low  tr_med  tr_high      ;;constant thrust levels
  thrust_x  thrust_y           ;;applied thrust levels
  
  ZERO
]

landers-own [
  xvel yvel    ;; x and y components of the lander's velocity
  fuel
]

  
to check-for-collision
  ask Peon [ 
    if (count landers in-radius lander-size > 1) [
      let vx1 xvel
      let vy1 yvel
      let vx2 [xvel] of Otto
      let vy2 [yvel] of Otto
      ask Otto [
        set xvel vx1
        set yvel vy1 
      ]
      set xvel vx2
      set yvel vy2
    ] 
  ]
end

to setup
  ;; (for this model to work with NetLogo's new plotting features,
  ;; __clear-all-and-reset-ticks should be replaced with clear-all at
  ;; the beginning of your setup procedure and reset-ticks at the end
  ;; of the procedure.)
  __clear-all-and-reset-ticks 
  setup-parameters
  setup-terrain
  setup-fuzzy
  setup-landers
  
  plot-vel
  plot-fuel
end

to setup-landers
  ifelse compete? [set numlanders 2] [set numlanders 1]
  create-landers numlanders [
    set shape ts
    set color blue
    set size lander-size
    set fuel fuel-init
    set heading 0
    setxy (platform-xcor + random (max-pxcor)) (max-pycor - size / 2)
    pendown
  ]
  
  set Otto lander (max [who] of landers)
  ask Otto [set color red]
  set Peon lander (min [who] of landers)
end

to setup-parameters
  set ts  "lander"
  set ts2 "lander2"
  set lander-size 5
  set gravity 0.001
  set toofast 0.25
end

to setup-fuzzy 
  set x_0 platform-xcor 
  set y_0 platform-ycor
  set x_a 25
  set y_a 10
  set y_b 30
  set v_a 0.15
  set v_b 0.30
  set tr_low  0.15
  set tr_med  0.25
  set tr_high 0.35
  set ZERO 0.0
end


to go
  if (any? landers with [shape = "skull"]) or (any? landers with [color = (green - 1)]) [ stop ]
  every 0.015 [
    ask landers [
      ifelse ycor + yvel > max-pycor [ 
        set xcor (xcor + xvel)
        set yvel 0 
      ]
      [ setxy (xcor + xvel) (ycor + yvel) ]
      set yvel yvel - gravity  ;; exert the force of gravity
      
      ;; detect crashes and insufficiently soft landings
      let colorbelow ([pcolor] of patch-at 0 -1)
      if not member? colorbelow [black 3] [
        ifelse (abs yvel > toofast) or
               (abs xvel > toofast / 2) 
               or (heading != 0) 
               or ((pxcor - platform-xcor) >= platform-width / 2)
        [ game-over ]
        [ set color green - 1 ]
      ]
      
      ;; switch back to the shape without the thrusters on
      if shape = ts2 and timer > 0.3
        [ set shape ts ]
    ]
    
    ask Otto [
      calc_Xmem
      calc_Ymem
      calc_VXmem
      calc_VYmem
      autogo 
    ]
    
    check-for-collision
      
    plot-vel
    plot-fuel
    heads-up-display ;;do some on-screen plotting
    tick
  ]
end

to heads-up-display
  ask patch (world-width / 4) (max-pycor - 2) [set plabel X_L]
  ask patch x_0 (max-pycor - 2) [set plabel X_M]
  ask patch (3 * world-width / 4) (max-pycor - 2) [set plabel X_R]
  ask patch (world-width - 2) y_a [set plabel Y_N]
  ask patch (world-width - 2) ((y_b + world-height) / 2) [set plabel Y_F]
end

to autogo
  ;;if shape = ts [set heading 0 pendown]
  set thrust_y ZERO
  set thrust_y thrust_y + (X_L * Y_F * VY_HP * ZERO)
  set thrust_y thrust_y + (X_L * Y_F * VY_HN * tr_low)
  set thrust_y thrust_y + (X_R * Y_F * VY_HN * tr_low)
  set thrust_y thrust_y + (X_F * Y_F * VY_MN * tr_low)
  set thrust_y thrust_y + (X_F * Y_F * VY_HN * tr_med)
  set thrust_y thrust_y + (X_L * Y_N * VY_L * tr_low)
  set thrust_y thrust_y + (X_L * Y_N * VY_MN * tr_med)
  set thrust_y thrust_y + (X_L * Y_N * VY_HN * tr_high)
  
  set thrust_y thrust_y + (X_M * Y_N * VY_MN * ZERO)
  set thrust_y thrust_y + (X_M * Y_N * VY_HN * tr_low)
  
  set thrust_y thrust_y + (X_R * Y_N * VY_L * tr_low)
  set thrust_y thrust_y + (X_R * Y_N * VY_MN * tr_med)
  set thrust_y thrust_y + (X_R * Y_N * VY_HN * tr_high)
  
  set thrust_y thrust_y + (X_F * Y_N * VY_MP * tr_low)
  set thrust_y thrust_y + (X_F * Y_N * VY_L * tr_med)
  set thrust_y thrust_y + (X_F * Y_N * VY_MN * tr_high)
  set thrust_y thrust_y + (X_F * Y_N * VY_HN * tr_high)
  
  set thrust_x ZERO
  set thrust_x thrust_x + (X_L * Y_F * VX_HN * tr_high)
  set thrust_x thrust_x + (X_L * Y_F * VX_MN * tr_med)
  set thrust_x thrust_x + (X_L * Y_F * VX_L  * tr_low)
  set thrust_x thrust_x - (X_L * Y_F * VX_HP * tr_low)
  
  set thrust_x thrust_x + (X_M * Y_F * VX_HN * tr_med)
  set thrust_x thrust_x + (X_M * Y_F * VX_MN * tr_low)
  set thrust_x thrust_x - (X_M * Y_F * VX_MP * tr_low)
  set thrust_x thrust_x - (X_M * Y_F * VX_HP * tr_med)
  
  set thrust_x thrust_x + (X_R * Y_F * VX_HN * tr_high)
  set thrust_x thrust_x - (X_R * Y_F * VX_L  * tr_low)
  set thrust_x thrust_x - (X_R * Y_F * VX_MP * tr_med)
  set thrust_x thrust_x - (X_R * Y_F * VX_HP * tr_high)
  
  set thrust_x thrust_x - (X_F * Y_F * VX_MN * tr_low)
  set thrust_x thrust_x - (X_F * Y_F * VX_L  * tr_med)
  set thrust_x thrust_x + (X_F * Y_F * VX_MP * tr_low)
  
  set thrust_x thrust_x + (X_L * Y_N * VX_HN * tr_high)
  set thrust_x thrust_x + (X_L * Y_N * VX_MN * tr_med)
  set thrust_x thrust_x + (X_L * Y_N * VX_L  * tr_low)
  set thrust_x thrust_x - (X_L * Y_N * VX_HP * tr_low)
  
  set thrust_x thrust_x + (X_M * Y_N * VX_HN * tr_med)
  set thrust_x thrust_x + (X_M * Y_N * VX_MN * tr_low)
  set thrust_x thrust_x - (X_M * Y_N * VX_MP * tr_low)
  set thrust_x thrust_x - (X_M * Y_N * VX_HP * tr_med)
  
  set thrust_x thrust_x + (X_R * Y_N * VX_HN * tr_high)
  set thrust_x thrust_x - (X_R * Y_N * VX_L  * tr_low)
  set thrust_x thrust_x - (X_R * Y_N * VX_MP * tr_med)
  set thrust_x thrust_x - (X_R * Y_N * VX_HP * tr_high)
  
  set thrust_x thrust_x - (X_F * Y_N * VX_HN * tr_low)
  set thrust_x thrust_x - (X_F * Y_N * VX_MN * tr_med)
  set thrust_x thrust_x - (X_F * Y_N * VX_L  * tr_high)
  set thrust_x thrust_x + (X_F * Y_N * VX_MP * tr_med)
  set thrust_x thrust_x + (X_F * Y_N * VX_HP * tr_low)
  
  auto-thrust
end

to-report vx
  report [xvel] of Otto
end

to-report vy
  report [yvel] of Otto
end

to plot-fuel
  set-current-plot "fuel"
  ask Peon [set-current-plot-pen "Peon-fuel" plot fuel]
  ask Otto [set-current-plot-pen "Otto-fuel" plot fuel]
end

to plot-vel
  set-current-plot "Otto's velocities"
  ask Otto [
    set-current-plot-pen "vx"  plot xvel
    set-current-plot-pen "vy"  plot yvel
  ]
end

to game-over  ;; turtle procedure
  set shape "skull"
  set color white
  set heading 0
  sound:play-note "Gunshot" 60 64 2
end

to rotate-left 
  ask Peon [lt 5]
end

to rotate-right  
  ask Peon [rt 5]
end

to thrust [ factor ]
  ask Peon [
    if fuel > 0 [
      set xvel xvel + thrust-amount * dx * factor
      set yvel yvel + thrust-amount * dy * factor
      set fuel fuel - 10 * thrust-amount * factor * (abs dx + abs dy)
      ;; lander2 has a visual indication that the thrusters are on
      set shape ts2
      reset-timer
    ]
  ]
end  

to auto-thrust;; turtle procedure
  ;;if shape = ts and color = red and fuel > 0 [
  if (fuel > 0) [
    set xvel xvel + thrust_x
    set yvel yvel + thrust_y
    set fuel fuel - 10 * (abs thrust_x + abs thrust_y)
    ;; lander2 has a visual indication that the thrusters are on
    set shape ts2
    reset-timer
  ]
end  

to calc_VXmem ;;called by Otto
  ;;calculates VX-membership functions VX_HN, VX_MN, VX_L, VX_MP, VX_HP
  set VX_HN ZERO
  set VX_MN ZERO
  set VX_L  ZERO
  set VX_MP ZERO
  set VX_HP ZERO
  if (xvel >= 0) [
    if (xvel < v_a) [
      set VX_MP (xvel / v_a)
      set VX_L 1 - VX_MP
    ]
    if (xvel >= v_a) and (xvel < v_b) [
      set VX_HP ((xvel - v_a) / (v_b - v_a))
      set VX_MP 1 - VX_HP
    ]
    if (xvel >= v_b) [set VX_HP 1]
  ]
  if (xvel < 0) [
    if (xvel > (- v_a)) [
      set VX_MN ((- xvel) / v_a)
      set VX_L 1 - VX_MN
    ]
    if (xvel <= (- v_a)) and (xvel > (- v_b)) [
      set VX_HN (((- xvel) - v_a) / (v_b - v_a))
      set VX_MN 1 - VX_HN
    ]
    if (xvel <= (- v_b)) [set VX_HN 1]
  ]
end

 to calc_VYmem ;;called by Otto
  ;;calculates VY-membership functions VY_HN, VY_MN, VY_L, VY_MP, VY_HP
  set VY_HN ZERO
  set VY_MN ZERO
  set VY_L  ZERO
  set VY_MP ZERO
  set VY_HP ZERO
  if (yvel >= 0) [
    if (yvel < v_a) [
      set VY_MP (yvel / v_a)
      set VY_L 1 - VY_MP
    ]
    if (yvel >= v_a) and (yvel < v_b) [
      set VY_HP ((yvel - v_a) / (v_b - v_a))
      set VY_MP 1 - VY_HP
    ]
    if (yvel >= v_b) [set VY_HP 1]
  ]
  if (yvel < 0) [
    if (yvel > (- v_a)) [
      set VY_MN ((- yvel) / v_a)
      set VY_L 1 - VY_MN
    ]
    if (yvel <= (- v_a)) and (yvel > (- v_b)) [
      set VY_HN (((- yvel) - v_a) / (v_b - v_a))
      set VY_MN 1 - VY_HN
    ]
    if (yvel <= (- v_b)) [set VY_HN 1]
  ]
end
  
to calc_Ymem
  ;; calculates Y-membership functions Y_N, Y_F
  set Y_N ZERO
  set Y_F ZERO
  let alpha 1 / (y_b - y_a)
  if (ycor <= y_a + y_0) [set Y_N 1]
  if (ycor >= y_b + y_0) [set Y_F 1]
  if (ycor > y_a + y_0) and (ycor < y_b + y_0) [
    set Y_N alpha * (ycor - y_a - y_0)
    set Y_F 1 - Y_N
  ]
end 


to calc_Xmem
  ;; calculates X-membership functions X_L, X_M, X_R, X_F
  set X_L ZERO
  set X_M ZERO
  set X_R ZERO
  set X_F ZERO
  let alpha (xcor - x_0) / x_a
  if (alpha >= 0) [
    if (alpha <= 1) [
      set X_R alpha
      set X_M 1 - X_R
    ]
    if (alpha > 1) [set X_R 1]
    if (xcor > (world-width - x_a)) [
      ;;set X_M 0
      set X_F (xcor - (world-width - x_a)) / x_a
      set X_R 1 - X_F
    ]
  ]
  if (alpha < 0) [
    if (alpha >= -1) [
      set X_L (- alpha)
      set X_M 1 - X_L
    ]
    if (alpha < -1) [set X_L 1]
    if (xcor < x_a) [
      ;;set X_M 0
      set X_F (x_a - xcor) / x_a
      set X_L 1 - X_F
    ]
  ]
end

to setup-terrain
  let terrain-color gray
  let platform-color blue

  set platform-xcor floor (world-width / 2) ;;vmc center platform
  ;; first use a turtle to draw the surface of the moon including the landing platform
  crt 1 [
    set color terrain-color
    setxy min-pxcor
          floor (min-pycor / 2)
    set heading 90
    repeat world-width [
      set pcolor color
      fd 1
      ;; draw the platform in blue
      if pxcor = platform-xcor - (platform-width / 2) [
        set heading 90
        set color platform-color
        set platform-ycor pycor ;;vmc
      ]
     
      ;; everything else is moon surface and should be gray
      if pxcor = platform-xcor + (platform-width / 2) [
        set color terrain-color
      ]
      ;; and if it isn't the platform it should also be jagged so vary ycor by the terrain-bumpiness
      if color != blue [
        ;; random-poisson usually gives small variations, occasionally larger ones
        let y ( ycor + one-of [1 -1] * random-poisson ( terrain-bumpiness ) )
        ;; prevent the drawing turtle from wrapping vertically while contouring the terrain
          if patch-at 0 (y - ycor) != nobody
          [ set ycor y ]
      ]
    ]
    die
  ]

  ;; then use more turtles to make solid gray below the gray line
  ask patches with [pcolor = terrain-color or pcolor = platform-color] [
    sprout 1 [
      set heading 180
      set color pcolor
      ;; if the drawing turtle is already at the bottom it should not continue
      while [can-move? 1] [
        fd 1
        set pcolor color
      ]
      if (pcolor = black) [set pcolor color]
      die
    ]
  ]
end

to draw-func [x_t y_t h_x h_y c_t] ;;used to plot membership function
  let h_t atan h_x h_y
  setxy x_t y_t
  set heading h_t
  set color c_t
  set pcolor c_t
  while [can-move? 1] [
    fd 1
    set pcolor c_t
  ]
end

to plot-X-membership
  crt 1 [
    
    draw-func (x_0 - x_a) (y_0) (x_a)   (world-height - y_0) 3 ;; left side of X_M
    draw-func (x_0 + x_a) (y_0) (- x_a) (world-height - y_0) 3 ;; right side of X_M   
    draw-func (x_0 + world-width / 2 - x_a) (y_0) (x_a) (world-height - y_0)   3 ;; left side of X_F
    draw-func (x_0 + world-width / 2 + x_a) (y_0) (- x_a) (world-height - y_0) 3 ;; right side of X_F
    draw-func (x_0) (y_0) (x_a) (world-height - y_0)  3 ;; left side of X_R

    ;;draw-func (xcor) (ycor) (1) (0) 3 ;; top of X_R

    ;draw-func () () () 3 ;; right side of X_R
    set heading atan (x_a) (y_0 - world-height)
    set pcolor color
    while [can-move? 1] [
      fd 1
      set pcolor color
    ]
    
    ;draw-func () () () 3 ;; right side of X_L
    setxy x_0 y_0
    set heading atan (- x_a) (world-height - y_0) 
    set pcolor color
    while [can-move? 1] [
      fd 1
      set pcolor color
    ]
    
    ;draw-func () () () 3 ;; top of X_L
    set heading -90
    repeat world-width / 2 - 2 * x_a [
      fd 1
      set pcolor color
    ]
    
    ;draw-func () () () 3 ;; left side of X_L
    set heading atan (- x_a) (y_0 - world-height)
    set pcolor color
    while [can-move? 1] [
      fd 1
      set pcolor color
    ]
    die
  ]
end

; Otto: A Fuzzy-Logic autonomous Lunar Lander
; Vic Castillo and Robert Harechmak 2011
; based on the original NetLogo Lunar Lander Copyright 2005 Uri Wilensky. All rights reserved.
; The full copyright notice is in the Information tab.
@#$#@#$#@
GRAPHICS-WINDOW
320
10
1585
796
-1
-1
5.0
1
10
1
1
1
0
1
0
1
0
250
0
150
1
1
1
ticks
30.0

BUTTON
51
132
117
165
NIL
setup
NIL
1
T
OBSERVER
NIL
S
NIL
NIL
1

BUTTON
133
132
199
165
NIL
go
T
1
T
OBSERVER
NIL
G
NIL
NIL
1

BUTTON
27
178
92
211
left
if compete? [rotate-left]
NIL
1
T
TURTLE
NIL
J
NIL
NIL
1

BUTTON
97
178
172
211
thrust
if compete? [thrust 1]
NIL
1
T
TURTLE
NIL
K
NIL
NIL
1

BUTTON
177
178
239
211
right
if compete? [rotate-right]
NIL
1
T
TURTLE
NIL
L
NIL
NIL
1

SLIDER
31
10
203
43
platform-width
platform-width
4.0
25.0
22
2.0
1
NIL
HORIZONTAL

SLIDER
31
45
203
78
terrain-bumpiness
terrain-bumpiness
0.0
2.0
0.8
0.1
1
NIL
HORIZONTAL

SLIDER
11
221
183
254
thrust-amount
thrust-amount
0.0
0.25
0.1
0.01
1
NIL
HORIZONTAL

SLIDER
11
259
183
292
fuel-init
fuel-init
0
250
75
1
1
NIL
HORIZONTAL

SWITCH
31
83
140
116
compete?
compete?
0
1
-1000

MONITOR
147
470
204
515
v_x
vx
17
1
11

MONITOR
208
471
265
516
v_y
vy
17
1
11

PLOT
9
683
310
803
Otto's velocities
time
vel
0.0
10.0
-0.2
0.0
true
true
"" ""
PENS
"vx" 1.0 0 -955883 true "" ""
"vy" 1.0 0 -13840069 true "" ""

BUTTON
11
467
120
500
NIL
plot-X-membership
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1

MONITOR
84
567
141
612
X_M
X_M
17
1
11

MONITOR
24
545
81
590
NIL
X_L
17
1
11

MONITOR
144
545
201
590
NIL
X_R
17
1
11

MONITOR
85
510
142
555
NIL
X_F
17
1
11

MONITOR
206
522
263
567
NIL
Y_F\n
17
1
11

MONITOR
206
569
263
614
NIL
Y_N
17
1
11

MONITOR
10
628
67
673
NIL
VX_HN
17
1
11

MONITOR
71
629
128
674
NIL
VX_MN
17
1
11

MONITOR
130
630
187
675
NIL
VX_L
17
1
11

MONITOR
191
630
248
675
NIL
VX_MP
17
1
11

MONITOR
252
629
309
674
NIL
VX_HP
17
1
11

PLOT
10
298
272
418
fuel
time
fuel
0.0
10.0
0.0
10.0
true
false
"" ""
PENS
"Peon-fuel" 1.0 0 -13345367 true "" ""
"Otto-fuel" 1.0 0 -2674135 true "" ""

@#$#@#$#@
## WHAT IS IT?

This model is based on the arcade game, Lunar Lander.  The object of the game is to land the red lunar module on the blue landing pad on the surface of the moon without crashing or breaking the module.

The lunar module is fragile, so you have to be moving extremely slowly to prevent damage when you touch down. You have one thruster that exerts a force depending on the tilt of the module.  You have the ability to tilt right and left.

## HOW TO USE IT

Buttons:  
SETUP starts the game over by creating a new surface for you to navigate and poising your module above that surface, ready for descent.  
GO starts the game.  Be ready; the module will start descending fairly quickly.  
LEFT and RIGHT tilt the module back and forth  
THRUST fires your rockets according to your current tilt.

Sliders:  
PLATFORM-WIDTH controls the width of the blue landing pad created at setup, a wider landing pad makes an easier target.  
TERRAIN-BUMPINESS controls the variation in the elevation of the lunar surface.  More bumpiness may mean you will have large obstacles to maneuver around.  
THRUST-AMOUNT controls the magnitude of the force of your rockets.

## THINGS TO NOTICE

When terrain-bumpiness is very high some of the randomly generated surfaces are not navigable.

## THINGS TO TRY

Try to land the module with the fewest adjustments.

Increase the THRUST-AMOUNT to make the game harder.

## EXTENDING THE MODEL

Currently, collisions with the edges of the module are not detected, so you can graze the side of a peak with the edge of the module without crashing.  It would be more realistic if these crashes were detected.

Add levels to the game by continually making the terrain bumpier, the platform smaller, or by some other method of making the game more difficult, perhaps alien spaceships.

Try to write a robot pilot that will automatically land the module safely.

## NETLOGO FEATURES

This model uses the RANDOM-POISSON reporter to create the terrain.  See its entry in the NetLogo Dictionary, and also http://mathworld.wolfram.com/PoissonDistribution.html.

As in many NetLogo games the EVERY command is used to control the speed of the game.

## RELATED MODELS

Projectile Attack, Gravitation

## HOW TO CITE

If you mention this model in an academic publication, we ask that you include these citations for the model itself and for the NetLogo software:  
- Wilensky, U. (2005).  NetLogo Lunar Lander model.  http://ccl.northwestern.edu/netlogo/models/LunarLander.  Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.  
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

In other publications, please use:  
- Copyright 2005 Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/LunarLander for terms of use.

## COPYRIGHT NOTICE

Copyright 2005 Uri Wilensky. All rights reserved.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:  
a) this copyright notice is included.  
b) this model will not be redistributed for profit without permission from Uri Wilensky. Contact Uri Wilensky for appropriate licenses for redistribution for profit.
@#$#@#$#@
default
true
0
Polygon -7500403 true true 150 5 40 250 150 205 260 250

airplane
true
0
Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15

arrow
true
0
Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150

box
false
0
Polygon -7500403 true true 150 285 285 225 285 75 150 135
Polygon -7500403 true true 150 135 15 75 150 15 285 75
Polygon -7500403 true true 15 75 15 225 150 285 150 135
Line -16777216 false 150 285 150 135
Line -16777216 false 150 135 15 75
Line -16777216 false 150 135 285 75

bug
true
0
Circle -7500403 true true 96 182 108
Circle -7500403 true true 110 127 80
Circle -7500403 true true 110 75 80
Line -7500403 true 150 100 80 30
Line -7500403 true 150 100 220 30

butterfly
true
0
Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
Circle -16777216 true false 135 90 30
Line -16777216 false 150 105 195 60
Line -16777216 false 150 105 105 60

car
false
0
Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
Circle -16777216 true false 180 180 90
Circle -16777216 true false 30 180 90
Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
Circle -7500403 true true 47 195 58
Circle -7500403 true true 195 195 58

circle
false
0
Circle -7500403 true true 0 0 300

circle 2
false
0
Circle -7500403 true true 0 0 300
Circle -16777216 true false 30 30 240

cow
false
0
Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
Polygon -7500403 true true 73 210 86 251 62 249 48 208
Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123

cylinder
false
0
Circle -7500403 true true 0 0 300

dot
false
0
Circle -7500403 true true 90 90 120

face happy
false
0
Circle -7500403 true true 8 8 285
Circle -16777216 true false 60 75 60
Circle -16777216 true false 180 75 60
Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240

face neutral
false
0
Circle -7500403 true true 8 7 285
Circle -16777216 true false 60 75 60
Circle -16777216 true false 180 75 60
Rectangle -16777216 true false 60 195 240 225

face sad
false
0
Circle -7500403 true true 8 8 285
Circle -16777216 true false 60 75 60
Circle -16777216 true false 180 75 60
Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183

fish
false
0
Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
Circle -16777216 true false 215 106 30

flag
false
0
Rectangle -7500403 true true 60 15 75 300
Polygon -7500403 true true 90 150 270 90 90 30
Line -7500403 true 75 135 90 135
Line -7500403 true 75 45 90 45

flower
false
0
Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
Circle -7500403 true true 85 132 38
Circle -7500403 true true 130 147 38
Circle -7500403 true true 192 85 38
Circle -7500403 true true 85 40 38
Circle -7500403 true true 177 40 38
Circle -7500403 true true 177 132 38
Circle -7500403 true true 70 85 38
Circle -7500403 true true 130 25 38
Circle -7500403 true true 96 51 108
Circle -16777216 true false 113 68 74
Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240

ghost
false
0
Polygon -7500403 true true 30 165 13 164 -2 149 0 135 -2 119 0 105 15 75 30 75 58 104 43 119 43 134 58 134 73 134 88 104 73 44 78 14 103 -1 193 -1 223 29 208 89 208 119 238 134 253 119 240 105 238 89 240 75 255 60 270 60 283 74 300 90 298 104 298 119 300 135 285 135 285 150 268 164 238 179 208 164 208 194 238 209 253 224 268 239 268 269 238 299 178 299 148 284 103 269 58 284 43 299 58 269 103 254 148 254 193 254 163 239 118 209 88 179 73 179 58 164
Line -16777216 false 189 253 215 253
Circle -16777216 true false 102 30 30
Polygon -16777216 true false 165 105 135 105 120 120 105 105 135 75 165 75 195 105 180 120
Circle -16777216 true false 160 30 30

house
false
0
Rectangle -7500403 true true 45 120 255 285
Rectangle -16777216 true false 120 210 180 285
Polygon -7500403 true true 15 120 150 15 285 120
Line -16777216 false 30 120 270 120

lander
true
0
Polygon -7500403 true true 45 75 150 30 255 75 285 225 240 225 240 195 210 195 210 225 165 225 165 195 135 195 135 225 90 225 90 195 60 195 60 225 15 225 45 75

lander2
true
0
Polygon -7500403 true true 45 75 150 30 255 75 285 225 240 225 240 195 210 195 210 225 165 225 165 195 135 195 135 225 90 225 90 195 60 195 60 225 15 225 45 75
Line -1 false 75 210 75 270
Line -1 false 150 210 150 285
Line -1 false 225 210 225 270

leaf
false
0
Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195

line
true
0
Line -7500403 true 150 0 150 300

line half
true
0
Line -7500403 true 150 0 150 150

pentagon
false
0
Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120

person
false
0
Circle -7500403 true true 110 5 80
Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
Rectangle -7500403 true true 127 79 172 94
Polygon -7500403 true true 195 90 240 150 225 180 165 105
Polygon -7500403 true true 105 90 60 150 75 180 135 105

plant
false
0
Rectangle -7500403 true true 135 90 165 300
Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90

rocket
true
0
Polygon -7500403 true true 120 165 75 285 135 255 165 255 225 285 180 165
Polygon -1 true false 135 285 105 135 105 105 120 45 135 15 150 0 165 15 180 45 195 105 195 135 165 285
Rectangle -7500403 true true 147 176 153 288
Polygon -7500403 true true 120 45 180 45 165 15 150 0 135 15
Line -7500403 true 105 105 135 120
Line -7500403 true 135 120 165 120
Line -7500403 true 165 120 195 105
Line -7500403 true 105 135 135 150
Line -7500403 true 135 150 165 150
Line -7500403 true 165 150 195 135

skull
true
0
Circle -7500403 true true 45 15 210
Rectangle -7500403 true true 90 180 210 270
Circle -16777216 true false 84 84 42
Circle -16777216 true false 174 84 42
Line -16777216 false 105 225 195 225
Line -16777216 false 120 210 120 240
Line -16777216 false 195 210 195 240
Line -16777216 false 150 210 150 240
Line -16777216 false 165 210 165 240
Line -16777216 false 180 210 180 240
Line -16777216 false 135 210 135 240
Line -16777216 false 105 210 105 240
Polygon -16777216 true false 150 135 135 180 165 180 150 135

square
false
0
Rectangle -7500403 true true 30 30 270 270

square 2
false
0
Rectangle -7500403 true true 30 30 270 270
Rectangle -16777216 true false 60 60 240 240

star
false
0
Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108

target
false
0
Circle -7500403 true true 0 0 300
Circle -16777216 true false 30 30 240
Circle -7500403 true true 60 60 180
Circle -16777216 true false 90 90 120
Circle -7500403 true true 120 120 60

tree
false
0
Circle -7500403 true true 118 3 94
Rectangle -6459832 true false 120 195 180 300
Circle -7500403 true true 65 21 108
Circle -7500403 true true 116 41 127
Circle -7500403 true true 45 90 120
Circle -7500403 true true 104 74 152

triangle
false
0
Polygon -7500403 true true 150 30 15 255 285 255

triangle 2
false
0
Polygon -7500403 true true 150 30 15 255 285 255
Polygon -16777216 true false 151 99 225 223 75 224

truck
false
0
Rectangle -7500403 true true 4 45 195 187
Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
Rectangle -1 true false 195 60 195 105
Polygon -16777216 true false 238 112 252 141 219 141 218 112
Circle -16777216 true false 234 174 42
Rectangle -7500403 true true 181 185 214 194
Circle -16777216 true false 144 174 42
Circle -16777216 true false 24 174 42
Circle -7500403 false true 24 174 42
Circle -7500403 false true 144 174 42
Circle -7500403 false true 234 174 42

turtle
true
0
Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99

wheel
false
0
Circle -7500403 true true 3 3 294
Circle -16777216 true false 30 30 240
Line -7500403 true 150 285 150 15
Line -7500403 true 15 150 285 150
Circle -7500403 true true 120 120 60
Line -7500403 true 216 40 79 269
Line -7500403 true 40 84 269 221
Line -7500403 true 40 216 269 79
Line -7500403 true 84 40 221 269

x
false
0
Polygon -7500403 true true 270 75 225 30 30 225 75 270
Polygon -7500403 true true 30 75 75 30 270 225 225 270

@#$#@#$#@
NetLogo 5.0.2
@#$#@#$#@
random-seed 1
setup
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
default
0.0
-0.2 0 1.0 0.0
0.0 1 1.0 0.0
0.2 0 1.0 0.0
link direction
true
0
Line -7500403 true 150 150 90 180
Line -7500403 true 150 150 210 180

@#$#@#$#@
0
@#$#@#$#@
